var t = getApp();

Page({
    data: {
        commission: {},
        commissionList: [],
        activeName: "-1",
        WXtitle: ""
    },
    onLoad: function(t) {
        this.getIndex(), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getTab: function(t) {
        this.getData();
    },
    getIndex: function() {
        var a = this, n = t.getNetAddresss("plugin.sales-commission.api.sale.index");
        t._getNetWork({
            url: n,
            success: function(t) {
                var n = t.data;
                1 === n.result ? (a.setData({
                    commission: n.data
                }), wx.setNavigationBarTitle({
                    title: n.data.name ? n.data.name : ""
                })) : wx.showToast({
                    title: n.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getData: function() {
        var a = this, n = t.getNetAddresss("plugin.sales-commission.api.sale.record");
        this.data.activeName >= 0 && (n += "&status=" + this.data.activeName), t._getNetWork({
            url: n,
            success: function(t) {
                var n = t.data;
                1 === n.result ? a.setData({
                    commissionList: n.data.data
                }) : wx.showToast({
                    title: n.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    }
});